package com.example.practice2023.controller;

import com.example.practice2023.pojo.Carousel;
import com.example.practice2023.pojo.Shop;
import com.example.practice2023.service.CarouselService;
import com.example.practice2023.service.ShopService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * ClassName: ShopController
 * Package: com.example.practice2023.controller
 * Description:
 *
 * @Author hyx
 * @Create 2023/7/4 14:03
 * @Version 1.0
 */
@RestController
@RequestMapping("/shop")
public class ShopController {
    @Resource
    private ShopService shopService;
    @RequestMapping("/select")
    public Map<String, Object> select() {
        return shopService.select();
    }
    //ying
    @RequestMapping(value = "/selectById",method = RequestMethod.GET)
    public Map<String,Object> selectById(@RequestParam Integer id){
        return shopService.selectById(id);
    }
    @RequestMapping(value = "/insertShop",method = RequestMethod.POST)
    public Map<String, Object> insertShop(@RequestBody Shop shop) {
        return shopService.insertShop(shop);
    }
    @RequestMapping(value = "/deleteById",method = RequestMethod.POST)
    public Map<String, Object> deleteById(@RequestParam Integer shopId) {
        return shopService.deleteById(shopId);
    }
    @RequestMapping(value = "/updateById",method = RequestMethod.POST)
    public Map<String, Object> updateById(@RequestBody Shop shop) {
        return shopService.updateById(shop);
    }
    @RequestMapping(value = "/selectByPage",method = RequestMethod.GET)
    public Map<String, Object> selectByPage(int page,int limit,Shop shop) {
        System.out.println(shop.getShopStatus());
        return shopService.selectByPage(page, limit,shop);
    }


}
